﻿using System;
using System.IO;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using WMSAML.Warehouse;

namespace ElectronicWMSA.Warehouse
{
    public partial class List_PickNoMapShowFrm : Form
    {
        PD_PickingMapEntity entity_Map = new PD_PickingMapEntity();
        int index = 0;
        public List_PickNoMapShowFrm(PD_PickingMapEntity entity_Map1, int index1)
        {
            InitializeComponent();
            entity_Map = entity_Map1;
            index = index1;

        }
        private void List_PickNoMapShowFrm_Load(object sender, EventArgs e)
        {
            if (index == 1)
            {
                if (entity_Map.MapImage != null)
                {
                    MemoryStream ms = new MemoryStream(entity_Map.MapImage);
                    this.pick_Image.BackgroundImage = Bitmap.FromStream(ms, true);
                }
            }
            else if (index == 2)
            {
                if (entity_Map.PickingMapImage != null)
                {
                    MemoryStream ms = new MemoryStream(entity_Map.PickingMapImage);
                    this.pick_Image.BackgroundImage = Bitmap.FromStream(ms, true);
                }
            }
        }
        private void btnClose_Click(object sender, EventArgs e)
        {
            this.Close();
        }
        protected override bool ProcessCmdKey(ref System.Windows.Forms.Message msg, System.Windows.Forms.Keys keyData)
        {
            int WM_KEYDOWN = 256;
            int WM_SYSKEYDOWN = 260;
            if (msg.Msg == WM_KEYDOWN | msg.Msg == WM_SYSKEYDOWN)
            {
                switch (keyData)
                {
                    case Keys.Escape:
                        this.Close();//esc关闭窗体
                        break;
                }
            }
            return false;
        }

        Point downPoint;
        private void panelTop_MouseDown(object sender, MouseEventArgs e)
        {
            downPoint = new Point(e.X, e.Y);
        }

        private void panelTop_MouseMove(object sender, MouseEventArgs e)
        {
            if (e.Button == MouseButtons.Left)
            {
                this.Location = new Point(this.Location.X + e.X - downPoint.X,
                    this.Location.Y + e.Y - downPoint.Y);
            }
        }


    }
}
